<?php

class VoteService extends AbstractService
{

    protected function _init()
    {
	$this->setMapper(new VoteMapper());
    }

    public function onAfterSave(AbstractModel $model = null)
    {
	if ($model->getId()) {
	    $targetModel = FactoryService::get($model->target_type)->get($model->target_id);
	    if ($targetModel) {
		if ($targetModel instanceof CommentModel) {
		    $cacheSlotsPk = new CacheSlotsPk(FactoryService::get($model->target_type)->getMapper()->getTableName(), $targetModel->getId());
		    $cacheSlotsPk->delete();
		}
	    }	    
	}
	return true;
    }

}